package com.you.pattern.observer.demo2;

public class Teacher implements Observer {

    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public Object update(Observable observable, Object obj) {
        if (observable instanceof Student) {
            Student student = (Student) observable;
            Question question = (Question) obj;
            System.out.println(this.name + " 收到了 " + question.getUserName() + "的问题为： " + question.getContent());
        }
        return null;
    }
}
